/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.yonsei.iwb.sdt.refinement;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import java.util.Vector;
import org.yonsei.iwb.sdt.datastructure.tree.BranchingType;

/**
 *
 * @author DK
 */
public abstract class Refinement {
    
    protected boolean branching_type = BranchingType.SATISFIED_TYPE;
    protected String refinement_name;
    protected ConstraintConstructor cc;
    protected int refinementType;
//    protected ExpandingHistory eh;
    private Vector<Resource> instanceSet = new Vector<Resource>();
    
   
    public int getRefinementType(){
        return this.refinementType;
    }
        
        
    public void setBranchingType(boolean type){
        this.branching_type = type;
    }
    
    public boolean getBranchingType(){
        return this.branching_type;
    }
                
    public void setInstanceSet(Resource r){
//        if(this.instanceSet == null){
//            this.instanceSet= new Vector<Resource>();
//            this.instanceSet.add(r);
//            
//        }else{
            this.instanceSet.add(r);            
//        }
//        this.instanceSet= new Vector<Resource>();
        
    }
    
    public void setInstanceSet(Vector<Resource> rset){
        this.instanceSet= new Vector<Resource>();
        this.instanceSet.addAll(rset);
    }
    
    public Vector<Resource> getInstanceSet(){
        return this.instanceSet;
    }
    
    public void setConstraintConstructor(ConstraintConstructor cc){
        this.cc = cc;
    }
    
    abstract public ExpandingHistory getExpandingHistory();
    
    abstract public void generateRefinementName();
    
    abstract public Refinement generateUpdatedRefinement(Vector<Resource> instanceSet);
        
    abstract public String getCoreName();
    
    abstract public String getName();
    
    /**
     * 주어진 constraint에 해당하는 인스턴스들의 집합을 찾아서 리턴
     * @param model 온톨로지 모델
     * @return 
     */
    abstract public Vector<Resource> getConstraintMatcherInstance(Model model);
    
    public ConstraintConstructor getConstraintConstructor(){
        return this.cc;
    }
    
    @Override
    public String toString(){
        return this.refinement_name;
    }
}
